function addRow(tableID)
{
	var tableRef = document.getElementById(tableID);
	if(tableRef.rows.length > 1)
	{
		var prevAct = document.getElementById("active"+ tableRef.rows.length);
 		prevAct.onchange = function (e){};
	}
    	var newRow   = tableRef.insertRow(tableRef.rows.length);
	var newCell  = newRow.insertCell(0);
    	var newText  = document.createElement('INPUT');
	newText.size=70;
	newText.type="file";
	newText.name = "zdjecie[]";
	newText.id = "active"+ tableRef.rows.length;
	newText.onchange = function (e){addRow(tableID);};
	newCell.appendChild(newText);
	var filescounta = document.getElementById("filescount");
	filescounta.value = Number(filescounta.value) + 1;
}